Relaxation oscillator

ABSTRACT

A relaxation oscillator is provided. A first current source provides a first current. A second current source provides a second current. A resistive element is coupled between the first current source and a ground. A capacitive element is coupled between the second current source and the ground. A comparator has a non-inverting input terminal, an inverting input terminal and an output terminal for outputting a compare result. A clock generator provides a clock signal according to the compare result. A switching unit alternately couples the non-inverting input terminal and the inverting input terminal of the comparator to the resistive element and the capacitive element according to the clock signal.

CROSS REFERENCE TO RELATED APPLICATIONS

This application claims priority of U.S. Provisional Application No. 61/596,353, filed on Feb. 8, 2012, the entirety of which is incorporated by reference herein.

BACKGROUND OF THE INVENTION

1. Field of the Invention

The invention relates to an oscillator, and more particularly to a relaxation oscillator.

2. Description of the Related Art

On-chip oscillators are in high demand as an external crystal replacement by low-cost and single-chip systems. The frequency stability of an oscillator against variations in temperature and supply voltage is a critical specification for an on-chip oscillator. Working with wide range of supply voltages is also preferred, to gain the most operating time when powered by a battery.

In general, a wide supply range oscillator with typical frequency stability can better accommodate temperature changes. Furthermore, relaxation oscillators with voltage averaging feedback (VAF) or an offset cancellation technique have good temperature stability, wherein the relaxation oscillators only work with a limited supply range. Moreover, an oscillator with a frequency tracking loop provides a stable output clock under wide supply voltage and temperature variations, but it requires a bandgap circuit with high precision, which increases the cost.

Therefore, a relaxation oscillator with adaptive supply voltage generation is desired to achieve the best frequency stability and fixed output frequency under a wide supply variation.

BRIEF SUMMARY OF THE INVENTION

Relaxation oscillators are provided. An embodiment of a relaxation oscillator is provided. The relaxation oscillator comprises: a first current source, providing a first current; a second current source, providing a second current; a resistive element coupled between the first current source and a ground; a capacitive element coupled between the second current source and the ground; a comparator, having a non-inverting input terminal, an inverting input terminal and an output terminal for outputting a compare result; a clock generator, providing a clock signal according to the compare result; and a switching unit, alternately coupling the non-inverting input terminal and the inverting input terminal of the comparator to the resistive element and the capacitive element according to the clock signal.

Furthermore, another embodiment of a relaxation oscillator is provided. The relaxation oscillator comprises: a current mirror coupled to a power supply, having a first output terminal for providing a first current and a second output terminal for providing a second current; a first transistor, having a first terminal, a second terminal and a first gate, wherein the first terminal and the first gate are coupled to the first output terminal of the current mirror; a second transistor, having a third terminal, a fourth terminal and a second gate, wherein the third terminal is coupled to the second output terminal of the current mirror, and the second gate is coupled to the first gate of the first transistor; a first resistor coupled to a ground; a capacitor coupled to the ground; a first switching unit coupled to the first and second transistors, the first resistor and the capacitor, alternately coupling the first resistor and the capacitor to the second terminal of the first transistor and the fourth terminal of the second transistor according to a clock signal; a comparator, comparing the voltages of the first and second output terminals of the current mirror to obtain a compare result; and a clock generator, providing the clock signal according to the compare result.

A detailed description is given in the following embodiments with reference to the accompanying drawings.

BRIEF DESCRIPTION OF DRAWINGS

The invention can be more fully understood by reading the subsequent detailed description and examples with references made to the accompanying drawings, wherein:

FIG. 1 shows as relaxation oscillator according to an embodiment of the invention;

FIG. 2 shows the switching unit of FIG. 1 according to an embodiment of the invention;

FIG. 3 shows a relaxation oscillator according to another embodiment of the invention;

FIG. 4 shows a schematic illustrating the switching units of FIG. 3;

FIG. 5 shows an example illustrating a timing diagram of the relaxation oscillator of FIG. 3;

FIG. 6 shows an example illustrating a significant mismatch existing between the NMOS transistors N1 and N2 of FIG. 3;

FIG. 7 shows the comparator of FIG. 3 according to an embodiment of the invention; and

FIG. 8 shows the clock generator of FIG. 3 according to an embodiment of the invention.

DETAILED DESCRIPTION OF THE INVENTION

The following description is of the best-contemplated mode of carrying out the invention. This description is made for the purpose of illustrating the general principles of the invention and should not be taken in a limiting sense. The scope of the invention is best determined by reference to the appended claims.

FIG. 1 shows a relaxation oscillator 100 according to an embodiment of the invention. The relaxation oscillator 100 comprises the current sources 110 and 120, a switching unit 130, a comparator 140, a clock generator 150, a resistive element (e.g., resistor R_(C)), a capacitive element (e.g., capacitor C_(C)) and a switch SW. The resistor R_(C) is coupled between the current source 110 and a ground GND, and the capacitor C_(C) is coupled between the current source 120 and the ground GND. The current source 110 coupled to a supply voltage V_(DD) is used to provide a current I_(r) to the resistor R_(C), so as to generate a voltage V_(r) to a terminal T2 of the switching unit 130. The current source 120 coupled to the supply voltage V_(DD) is used to provide a current I_(c) to the capacitor C_(C), so as to generate a voltage V_(c) to a terminal T1 of the switching unit 130. The non-inverting and inverting input terminals of the comparator 140 are coupled to the terminals T3 and T4 of the switching unit 130, respectively. According to an output clock V_(out) from the clock generator 150, the switching unit 130 alternately provides the voltage V_(c) or V_(r) to the non-inverting input terminal of the comparator 140 via the terminal T3 thereof, and also alternately provides the voltage V_(r) or V_(c) to the inverting input terminal of the comparator 140 via the terminal T4 thereof. For example, the switching unit 130 respectively provides the voltages V_(c) and V_(r) to the non-inverting and inverting input terminals of the comparator 140 when the output clock V_(out) is at a first voltage level (e.g. a HIGH level), and the switching unit 130 respectively provides the voltages V_(r) and V_(c) to the non-inverting and inverting input terminals of the comparator 140 when the output clock V_(out) is at a second voltage level (e.g. a LOW level). The comparator 140 compares the voltages V_(r) and V_(c) to obtain a reset pulse V_(rst), and provides the reset pulse V_(rst) to the clock generator 150 and the switch SW. The switch SW is coupled to the capacitor C_(C) in parallel, which is used to discharge the capacitor C_(C) according to the reset pulse V_(rst). The clock generator 150 generates the output clock V_(out) according to the reset pulse V_(rst). In one example, the clock generator 150 flips the clock signal Vout when the compare result (the reset pulse V_(rst)) indicates that the cross voltage Vc of the capacitive element Cc substantially reaches the cross voltage Vr of the resistive element Rc. Therefore, the capacitor C_(C) is discharged when the clock signal is flipped (e.g., transits from high level to low level and from low level to high level) or when the compare result indicates that the voltage Vc substantially reaches the voltage Vr. In FIG. 1, by interchanging the input signals of the non-inverting and inverting input terminals of the comparator 140, an offset voltage caused by the device mismatches existing in the comparator 140 is eliminated. Thus, clock frequency of the output clock V_(out) is stable.

FIG. 2 shows the switching unit 130 of FIG. 1 according to an embodiment of the invention. The switching unit 130 comprises two switches SW1 and SW2. According to the output clock V_(out), the switch SW1 selectively couples the terminal T3 to the terminal T1 or T2, and the switch SW2 selectively couples the terminal T4 to the terminal T1 or T2. For example, the terminals T3 and T4 are respectively coupled to the terminals T1 and T2 when the output clock V_(out) is at a first voltage level, and the terminals T3 and T4 are respectively coupled to the terminals T2 and T1 when the output clock V_(out) is at a second voltage level.

FIG. 3 shows a relaxation oscillator 200 according to another embodiment of the invention. The relaxation oscillator 200 comprises a current mirror 210, the switching units 220 and 230, the NMOS transistors N1 and N2, a resistor R_(C), a capacitor CC and a NMOS transistor M_(SW), a comparator 240 and a clock generator 250. In the embodiment, the NMOS transistor M_(SW) functions as a switch. The current mirror 210 comprises a bias circuit 260 and the mirror transistors MM1 and MM2. The mirror transistor MM1 is coupled between the supply voltage V_(DD) and a node n3, and the mirror transistor MM2 is coupled between the supply voltage V_(DD) and a node n4. The bias circuit 260 can be a constant-gm bias circuit for generating a bias current I_(b). The bias circuit 260 comprises the mirror transistors MM3 and MM4, the NMOS transistors N3 and N4 and a resistor R. The mirror transistor MM3 is coupled between the supply voltage V_(DD) and a node n1, which has a gate coupled to the node n1. The mirror transistor MM4 is coupled between the supply voltage V_(DD) and a node n2, which has a gate coupled to the node n1. The NMOS transistor N3 is coupled between the node n1 and the resistor R, which has a gate coupled to the node n2. The NMOS transistor N4 is coupled between the node n2 and the ground GND, which has a gate coupled to the node n2. The resistor R is coupled between the NMOS transistor N3 and the ground GND. In response to the bias current I_(b), the mirror transistor MM1 provides a current I_(r) to the node n3, and the mirror transistor MM2 provides a current I_(c) to the node n4. The terminals T1 and T2 of the switching unit 220 are coupled to the mirror transistors MM1 and MM2, respectively, and the terminals T3 and T4 of the switching unit 220 are coupled to the NMOS transistors N1 and N2, respectively. According to the chopper clocks V_(chp) and V_(chpb) from the clock generator 250, the switching unit 220 alternately couples the NMOS transistors N1 and N2 to the nodes n3 and n4. Furthermore, the terminals T1 and T2 of the switching unit 230 are coupled to the NMOS transistors N1 and N2, respectively, and the terminals T3 and T4 of the switching unit 230 are coupled to the resistor R_(C) and capacitor C_(C), respectively. According to the chopper clocks V_(chp) and V_(chpb) from the clock generator 250, the switching unit 230 alternately couples the NMOS transistors N1 and N2 to the resistor R_(C) and capacitor C_(C). The resistor R_(C) comprises the resistors R_(p) and R_(n) connected in series. The comparator 240 has a second input terminal IN2 coupled to the node n3 and a first input terminal IN1 coupled to the node n4. The comparator 240 compares a voltage V_(bn) at the node n3 and a voltage V_(cmp) at the node n4 to obtain a reset pulse V_(rst). However, this is for illustrative purpose and not meant to be a limitation. For example, the comparator 240 may compare the voltage Vr of the first resistor Rc and the voltage Vc of the capacitor Cc to obtain the compare result. The NMOS transistor M_(SW) is coupled to the capacitor C_(C) in parallel, which is used to discharge the capacitor C_(C) according to the reset pulse V_(rst). The clock generator 150 generates an output clock V_(out) and the chopper clocks V_(chp) and V_(chpb) according to the reset pulse V_(rst). In this way, by switching the differential inputs of the comparator 240 every half cycle of the output clock Vout, the frequency drift induced by comparator offset can be reduced.

In FIG. 3, a current-mode comparator formed by the NMOS transistors N1 and N2, performs a voltage comparison between the voltages V_(r) and V_(c), wherein the voltage V_(c) is a voltage across the capacitor C_(c). In one embodiment, the capacitor C_(c) is a metal-over-metal (MoM) capacitor. The current mode comparator is ideal for power saving by the reusing of current and the oscillation frequency could be derived as per the following equation (1):

$\begin{matrix} {{{\Delta\; T} = {\frac{I_{r} \cdot R_{c} \cdot C_{c}}{I_{c}} + \tau}},} & (2) \end{matrix}$ where R_(c) is a reference generating resistor, I_(c) is the charging current of the capacitor C_(c), I_(r) is the biasing current of the resistor R_(c) and τ represents the delay induced by the current mode comparator and the comparator 240, wherein τ is much smaller than the oscillation period of the relaxation oscillator 200 and can be ignored. As a result, temperature stability is dominant by the variation of the resistor R_(c), because the ratio between the currents I_(r) and I_(c) is temperature-independent and the temperature variation of the capacitor C_(c) is also negligible. However, if the device mismatch of the NMOS transistors N1 and N2 is taken into account, the equation (1) is re-written as the following equation (2):

$\begin{matrix} {{{\Delta\; T} = {\frac{I_{r} \cdot R_{c} \cdot C_{c}}{I_{c}} + \frac{V_{os} \cdot C_{c}}{I_{c}} + \tau}},} & (2) \end{matrix}$ where V_(os) represents the input-referred offset voltage of the NMOS transistors N1 and N2. It is obvious that I_(c) greatly affects the temperature stability of the relaxation oscillator 200. A self-chopped technique is used to solve this problem without the adoption of temperature-independent current references. The NMOS transistors N1 and N2 cancel the frequency drift caused by the offset voltage V_(os) every half cycle of the chopper clocks V_(chp) and V_(chpb). To further improve the temperature stability, the resistor R_(c) comprises the p-poly resistor R_(p) and the n-poly resistor R_(n) coupled in series, wherein the p-poly resistor R_(p) and the n-poly resistor R_(n) have opposite temperature coefficients, thereby reducing the temperature variation of the resistor R_(c).

FIG. 4 shows a schematic illustrating the switching units 220 and 230 of FIG. 3. In FIG. 4, a switch SW3 is coupled between the terminals T1 and T3, a switch SW4 is coupled between the terminals T2 and T3, a switch SW5 is coupled between the terminals T1 and T4, and a switch SW6 is coupled between the terminals T2 and T4. The switches SW3 and SW6 are controlled by the clock signal V_(chp), and the switches SW4 and SW5 are controlled by the clock signal V_(chpb). In one embodiment, each of the switches SW3, SW4, SW5 and SW6 is a transmission gate. Furthermore, the chopper clocks V_(chp) and V_(chpb) may be complementary or non-overlapped.

FIG. 5 shows an example illustrating a timing diagram of the relaxation oscillator 200 of FIG. 3. Referring to FIG. 3, FIG. 4 and FIG. 5 together, for the initial phase, the chopper clock V_(chp) is at a low voltage level, and the NMOS transistors N1 and N2 are respectively connected to the resistor R_(c) and the capacitor C_(c) via the switching unit 230. Next, the capacitor C_(c) is charged, and the voltage V_(c) rises. When the voltage V_(c) substantially reaches the voltage V_(r), the voltage V_(cmp) goes high which substantially reaches the voltage Vbn and the reset pulse V_(rst) is triggered by the comparator 240. Furthermore, the reset pulse V_(rst) is also used for the generation of dual-phase and non-overlapped chopper clocks V_(chp) and V_(chpb). In the clock generator 250, the toggle of the reset pulse V_(rst) flips the chopper clocks V_(chp) and V_(chpb), which interchanges the drain/source connections of the NMOS transistors N1 and N2, and another charging cycle starts. After the capacitor C_(c) is charged to the voltage V_(r) again, the whole chopping cycle completes.

FIG. 6 shows an example illustrating a significant mismatch existing between the NMOS transistors N1 and N2 of FIG. 3. The timing error caused by the offset voltage V_(os) is eliminated. The offset voltage V_(os) only degrades the 50% duty cycle of the chopper clocks V_(chp) and V_(chpb), which is less important than the stability of clock frequency. It is noted that the chopper clock V_(chp) is also the output clock V_(out) of the relaxation oscillator 200.

In the relaxation oscillator 200 of FIG. 3, a transition threshold of V_(cmp) is important, which decides the discharging instance of the capacitor C_(c) and also the period of the output clock V_(out). To generate a stable clock, an adaptive supply generation with threshold tracking technique is used in the comparator 240.

FIG. 7 shows the comparator 240 of FIG. 3 according to an embodiment of the invention. The comparator 240 comprises a voltage generator 242, a threshold control loop 244 and a buffer unit 246 and the inverters INV1 and INV2. The voltage generator 242 comprises a current source I_(bs), a PMOS transistor P4, the NMOS transistors N11 and N12 and an amplifier OP. The voltage generator 242 provides a low dropout reference voltage V_(LDO) at an output terminal T_(out). The current source I_(bs) coupled to the supply voltage V_(DD) is used to provide a constant current to the PMOS transistor P4. The PMOS transistor P4 is coupled between the current source I_(bs) and the NMOS transistor N12, and has a gate coupled to the second input terminal IN2 for receiving the voltage V_(bn). The NMOS transistor N12 is coupled between the PMOS transistor P4 and the NMOS transistor N11, and has a gate coupled to the second input terminal IN2. The NMOS transistor N11 is coupled between the NMOS transistor N12 and the ground GND, and has a gate coupled to the second input terminal IN2. The PMOS transistor P4 and NMOS transistors N12 and N11 together form an inverter biased with the constant current I_(bs) and the voltage V_(bn) (e.g., the voltage of the second output terminal of the current mirror 210). The amplifier OP has a non-inverting terminal coupled to the current source I_(bs) and the PMOS transistor P4, an inverting terminal coupled to the output terminal T_(out), and an output terminal coupled to the output terminal T_(out). The threshold control loop 244 comprises a PMOS transistor P3 and the NMOS transistors N9 and N10. The PMOS transistor P3 is coupled between the output terminal T_(out) and a node n7, and has a gate coupled to the second input terminal IN2. The NMOS transistor N10 is coupled between the node n7 and the NMOS transistor N9, and has a gate coupled to the second input terminal IN2. The NMOS transistor N9 is coupled between the NMOS transistor N10 and the ground GND, which has a gate coupled to the node n7. The threshold control loop 244 is powered by the low dropout reference voltage V_(LDO) and is used to provide a bias signal V_(bias) to the buffer unit 246 according to the input signal V_(bn) received at the second input terminal IN2 (e.g., the second output terminal of the current mirror 210), so as to regulate a transition threshold of the buffer unit 246 to close to the voltage V_(bn). The buffer unit 246 comprises the PMOS transistors P1 and P2 and the NMOS transistors N5-N8. The PMOS transistor P1 is coupled between the output terminal T_(out) and a node n5, and has a gate coupled to the first input terminal IN1 for receiving the voltage V_(cmp). The NMOS transistor N6 is coupled between the node n5 and the NMOS transistor N5, and has a gate coupled to the first input terminal IN1. The NMOS transistor N5 is coupled between the NMOS transistor N6 and the ground GND, and has a gate coupled to the node n7 of the threshold control loop 244 for receiving the bias signal V_(bias). The PMOS transistor P2 is coupled between the output terminal T_(out) and a node n6, and has a gate coupled to the node n5. The NMOS transistor N8 is coupled between the node n6 and the NMOS transistor N7, and has a gate coupled to the node n5. The NMOS transistor N7 is coupled between the NMOS transistor N8 and the ground GND, and has a gate coupled to the node n7. The inverter INV1 is coupled between the node n6 and the inverter INV2. The buffer unit 246 provides an output signal according to the input signal Vcmp received at the first input terminal IN1 (e.g., the first output terminal of the current mirror 210) and the bias signal Vbias, wherein the output signal represents a compare result of Vbn and Vcmp. The inverter INV2 is coupled to an output terminal of the inverter INV1, and is used to output the reset pulse V_(rst). Specifically, the threshold control loop 244, buffer unit 246 and the inverters INV1 and INV2 are powered by the reference voltage V_(LDO).

In the voltage generator 242, a reference voltage V_(bs) is generated by biasing a dummy inverter formed by the PMOS transistor P4 and the NMOS transistors N11 and N12, with the constant current provided by the current source I_(bs). It is to be noted that the gate of the dummy inverter is biased with the voltage V_(bn) rather than an output of the dummy inverter. By proper sizing, a transition threshold of the dummy inverter is set, to close to the voltage V_(bn), which indicates that if an inverter with the same size PMOS transistor P4 and NMOS transistors N11 and N12 is biased with the voltage V_(bn), the transition threshold would be in the vicinity of the voltage V_(bn). To eliminate the systematic and random offset induced by the voltage generator 242, the threshold control loop 244 is utilized to regulate the transition threshold of the buffer unit 246.

FIG. 8 shows the clock generator 250 of FIG. 3 according to an embodiment of the invention. The clock generator 250 comprises a plurality of delay cells DL, a D flip-flop 252, a low-to-high level shifter 254 and a non-overlapped clock generator 256, wherein the non-overlapped clock generator 256 comprises the NOR logic gates NOR1 and NOR2 and the inverters INV3-INV9. First, the reset pulse V_(rst) is delayed by the delay cells DL, and then the delayed reset pulse V_(rst) toggles the D flip-flop 252. A divided-by-2 clock is converted to the supply voltage V_(DD) by the low-to-high level shifter 254. Next, the level-shifted clock is processed by the non-overlapped clock generator 256, and then the chopper clocks V_(chp) and V_(chpb) are produced. Therefore, by using the chopper clocks V_(chp) and V_(chpb) to control the switching units 220 and 230, the relaxation oscillator 200 of FIG. 3 with adaptive supply generation provides the stable output clock V_(out) to accommodate variations in temperature and supply voltages.

While the invention has been described by way of example and in terms of the preferred embodiments, it is to be understood that the invention is not limited to the disclosed embodiments. On the contrary, it is intended to cover various modifications and similar arrangements (as would be apparent to those skilled in the art). Therefore, the scope of the appended claims should be accorded the broadest interpretation so as to encompass all such modifications and similar arrangements. 

What is claimed is:
 1. A relaxation oscillator, comprising: a current mirror coupled to a power supply, having a first output terminal for providing a first current and a second output terminal for providing a second current; a first transistor, having a first terminal, a second terminal and a first gate, wherein the first terminal and the first gate are coupled to the first output terminal of the current mirror; a second transistor, having a third terminal, a fourth terminal and a second gate, wherein the third terminal is coupled to the second output terminal of the current mirror, and the second gate is coupled to the first gate of the first transistor; a first resistor coupled to a ground; a capacitor coupled to the ground; a first switching unit coupled to the first and second transistors, the first resistor and the capacitor, alternately coupling the first resistor and the capacitor to the second terminal of the first transistor and the fourth terminal of the second transistor according to a clock signal; a comparator, comparing the voltages of the first and second output terminals of the current mirror or comparing the voltages of the first resistor and the capacitor to obtain a compare result; and a clock generator, providing the clock signal according to the compare result.
 2. The relaxation oscillator as claimed in claim 1, further comprising: a second switching unit coupled to the current mirror and the first and second transistors, alternately coupling the first and second output terminals of the current mirror to the first terminal of the first transistor and the third terminal of the second transistor according to the clock signal.
 3. The relaxation oscillator as claimed in claim 1, further comprising: a switch coupled to the capacitor in parallel, discharging the capacitor according to the compare result.
 4. The relaxation oscillator as claimed in claim 3, wherein the capacitor is discharged by the switch when the clock signal is flipped or when the compare result indicates that the voltage of the first output terminal of the current mirror substantially reaches the voltage of the second output terminal of the current mirror or the voltage of the first resistor substantially reaches the voltage of the capacitor.
 5. The relaxation oscillator as claimed in claim 1, wherein when the clock signal is at a first voltage level, the first switching unit couples the first resistor and the capacitor to the second terminal of the first transistor and the fourth terminal of the second transistor, respectively, and when the clock signal is at a second voltage level, the first switching unit couples the capacitor and the first resistor to the second terminal of the first transistor and the fourth terminal of the second transistor, respectively.
 6. The relaxation oscillator as claimed in claim 2, wherein when the clock signal is at a first voltage level, the second switching unit couples the first and second output terminals of the current mirror to the first terminal of the first transistor and the third terminal of the second transistor, respectively, and when the clock signal is at a second voltage level, the second switching unit couples the second and first output terminals of the current mirror to the first terminal of the first transistor and the third terminal of the second transistor, respectively.
 7. The relaxation oscillator as claimed in claim 1, wherein the clock generator flips the clock signal when the compare result indicates that the voltage of the first output terminal of the current mirror substantially reaches the voltage of the second output terminal of the current mirror or when the compare result indicates that the voltage of the first resistor substantially reaches the voltage of the capacitor.
 8. The relaxation oscillator as claimed in claim 1, wherein the first resistor comprises: an n-poly resistor and a p-poly resistor coupled in series.
 9. The relaxation oscillator as claimed in claim 1, wherein the current mirror comprises: a bias circuit coupled between the power supply and the ground, providing a bias current; a first mirror transistor coupled between the power supply and the first output terminal of the current mirror, having a gate coupled to the bias circuit, and providing the first current according the bias current; and a second mirror transistor coupled between the power supply and the second output terminal of the current mirror, having a gate coupled to the bias circuit, and providing the second current according the bias current.
 10. The relaxation oscillator as claimed in claim 9, wherein the bias circuit comprises: a third mirror transistor coupled between the power supply and a first node, having a gate coupled to the first node; a fourth mirror transistor coupled between the power supply and a second node, having a gate coupled to the first node; a third transistor coupled to the first node, having a gate coupled to the second node; a fourth transistor coupled between the second node and the ground, having a gate coupled to the second gate; and a second resistor coupled between the third transistor and the ground, wherein the bias current is a current flowing through the second resistor.
 11. The relaxation oscillator as claimed in claim 1, wherein the first and second transistors are NMOS transistors.
 12. The relaxation oscillator as claimed in claim 1, wherein the comparator comprises: a buffer unit, providing the compare result according to the voltage of the first output terminal of the current mirror and a bias signal; and a threshold control loop, providing the bias signal to the buffer unit according to the voltage of the second output terminal of the current mirror, so as to regulate a transition threshold of the buffer unit.
 13. The relaxation oscillator as claimed in claim 12, wherein the threshold control loop regulates the transition threshold of the buffer unit to close to the voltage of the second output terminal of the current mirror, wherein the threshold control loop comprises: a first PMOS transistor coupled between a reference voltage and a first node, having a gate for receiving the voltage of the second output terminal of the current mirror; a first NMOS transistor coupled to a ground, having a gate coupled to the first node; and a second NMOS transistor coupled between the first node and the first NMOS transistor, having a gate for receiving the voltage of the second output terminal of the current mirror, wherein the bias signal is a signal of the first node.
 14. The relaxation oscillator as claimed in claim 12, wherein the comparator further comprises: a voltage generator, having an output terminal for providing a reference voltage according to a constant current and the voltage of the second output terminal of the current mirror; wherein the buffer unit and the threshold control loop are powered by the reference voltage, and the voltage generator comprises: a current source, providing the constant current; and an inverter coupled to the current source, having a terminal receiving the voltage of the second output terminal of the current mirror. 